#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int searchInsert(int* nums, int numsSize, int target) {
    for (int i = 0; i < numsSize; i++)
    {
        if (nums[0] > target)
        {
            return 0;
        }
        else if (nums[numsSize - 1] < target)
        {
            return numsSize;
        }
        else if (nums[i] == target)
        {
            return i;
        }
        else if (nums[i] <= target && nums[i + 1] > target)
        {
            return i + 1;
        }
    }
    return 0;
}


struct ListNode* deleteDuplicates(struct ListNode* head) {
    if (head == NULL)
        return head;

    struct ListNode* p = head;
    struct ListNode* current = p->next;
    while (current != NULL) {
        struct ListNode* temp = current->next;
        if (current->val == p->val)
            p->next = temp;
        else p = current;
        current = temp;
    }
    return head;
}